package org.tik.mybatis.executor;

import org.tik.mybatis.mapping.BoundSql;
import org.tik.mybatis.mapping.MappedStatement;
import org.tik.mybatis.session.ResultHandler;
import org.tik.mybatis.transaction.Transaction;

import java.sql.SQLException;
import java.util.List;

/**
 * SQL执行入口，确定出事务和操作和 SQL 执行的统一标准接口
 *
 * @ClassName: Executor
 * @author: pengwei
 * @data 2022年10月18日 20:27:00
 */
public interface Executor {

    ResultHandler NO_RESULT_HANDLER = null;

    <E> List<E> query(MappedStatement ms, Object parameter, ResultHandler resultHandler, BoundSql boundSql);

    Transaction getTransaction();

    void commit(boolean required) throws SQLException;

    void rollback(boolean required) throws SQLException;

    void close(boolean forceRollback) throws SQLException;
}
